import 'package:enterprise_v6_app/app/components/custom_app_bar.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/special_list/job_ticket/common/common_work_detail_all/work_detail/work_detail_view.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/special_list/job_ticket/common/common_work_detail_all/work_detail_all_controller.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/special_list/job_ticket/common/common_work_detail_all/work_flow_chart/work_flow_chart_view.dart';

///作业票-详情总页面
class WorkDetailAllWidget extends StatelessWidget {
  WorkDetailAllWidget({super.key});

  final controller = Get.put(WorkDetailAllController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Scaffold(
            appBar: CustomAppBar(
              titleText: '详情',
            ),
            body: DefaultTabController(
              length: 2,
              child: Column(
                children: [
                  Container(
                    margin: EdgeInsets.symmetric(horizontal: 50.w),
                    height: 54.w,
                    child: TabBar(
                      controller: controller.tabController,
                      tabs: const [
                        Tab(text: '详情'),
                        // Tab(text: '作业记录'),
                        Tab(text: '流程图'),
                      ],
                      dividerColor: Colors.transparent,
                      labelPadding: EdgeInsets.only(bottom: 20.w),
                      labelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      unselectedLabelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      labelColor: Colors.black,
                      unselectedLabelColor: const Color(0xffA0A7B5),
                      indicatorPadding:
                          EdgeInsets.only(top: 35.w, bottom: 10.w),
                      indicator: const BoxDecoration(
                        image: DecorationImage(
                          image: AssetImage(
                            AppImages.icon_app_work_plan,
                          ),
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Container(
                      color: const Color(0xffF5F5F6),
                      child: TabBarView(
                        controller: controller.tabController,
                        physics: controller.tabController.index == 2
                            ? const NeverScrollableScrollPhysics()
                            : null,
                        children: [
                          WorkDetailWidget(
                            ticketReceiptId: controller.ticketReceiptId,
                          ),
                          // WorkOperationRecordWidget(),
                          WorkFlowChartWidget(
                              processEncoding: controller.processEncoding),
                        ],
                      ),
                    ),
                  ),
                ],
              ),
            ),
          );
        });
  }
}
